<?php
/**
 * Author: adophper <hello@adophper.com,www.dutuwang.net>
 * Date: 2016/6/16
 * Time: 23:57
 */
namespace common\base;

use Yii;
use yii\web\Controller;
/**
 * BaseController
 */
class BaseController extends Controller {

    public $defaultPageSize;

    public function init()
    {
        if ($this->defaultPageSize == null) {
            if (isset(Yii::$app->params['defaultPageSize'])) {
                $this->defaultPageSize = Yii::$app->params['defaultPageSize'];
            } else {
                $this->defaultPageSize = 15;
            }
        }
    }

    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
            'captcha' => [
                'class' => 'yii\captcha\CaptchaAction',
                'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
            ],
            'page' => [
                'class' => 'yii\web\ViewAction',
            ],
        ];
    }

    public function beforeAction($action)
    {
        return parent::beforeAction($action);
    }

    public function render($view, $params = []) {
        return parent::render($view, $params);
    }

    public function renderAjax($view, $params = []) {
        return parent::renderAjax($view, $params);
    }
}